package net.flyinggroup.smb;

import net.flyinggroup.smb.service.SmbService;
import org.jasypt.encryption.StringEncryptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;

@SpringBootApplication
public class SmbApplication implements CommandLineRunner {
    @Autowired
    private SmbService service;
    @Autowired
    private Environment environment;
    @Autowired
    private StringEncryptor encryptor;

    public static void main(String[] args) {
        SpringApplication.run(SmbApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println(encryptor.encrypt("WORKGROUP"));
        System.out.println(encryptor.encrypt("walker"));
        System.out.println(encryptor.encrypt("start#338"));
        service.printFile();
        System.out.println(service.getPasswordUsingEnvironment(environment));

    }
}
